const express = require("express");
const app = express();
const session = require('express-session');

app.set("view engine","ejs");

//使用session
app.use(session({
    secret: 'keyboard cat',
    resave: false,
    saveUninitialized: true
}));


//路由中间件，静态页面
app.use(express.static("./public"));
app.use(express.static("./uploads"));
app.use(express.static("./assistant"));
app.use(express.static("./images"));
app.use(express.static("./voices"));
app.use(express.static("./public/upload/pay/"));
app.use(express.static("./views"));
app.use(express.static("./views/static/css"));
app.use(express.static("./views/static/js"));
app.use(express.static("./views/static/media"));
app.use(express.static("./views/static/media"));

app.get("/download",function (req, res, next) {
    res.render("./download");
});


//404错误
app.use('/',function (req, res) {
    console.log('404',req.url);
    res.send('404');
});

module.exports = app;

app.listen(3000);